package com.mall.b2c.domain.member;

import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ManyToOne;
import javax.persistence.PrePersist;
import javax.persistence.Table;

import com.mall.b2c.domain.goods.GoodsDomain;
import com.mall.common.domain.BaseEntity;

/**
 * 到货通知
 * 
 * @author lzx
 *
 */
@Entity
@Table(name = "b2c_stock_notice")
public class StockNoticeDomain extends BaseEntity {

	private static final long serialVersionUID = -1495025334057384731L;
	private Boolean isNotice; // 是否已通知
	private Date noticeDate; // 通知时间
	private String memo; // 留言
	private Integer num; //预定数量
	private GoodsDomain goods; // 商品
	private MemberDomain member; // 会员

	@PrePersist
	public void prePersist(){
		if(isNotice == null){
			isNotice = false;
		}

		if(num == null){
			num = 1;
		}
	}
	
	public Boolean getIsNotice() {
		return isNotice;
	}

	public void setIsNotice(Boolean isNotice) {
		this.isNotice = isNotice;
	}

	public Date getNoticeDate() {
		return noticeDate;
	}

	public void setNoticeDate(Date noticeDate) {
		this.noticeDate = noticeDate;
	}

	public String getMemo() {
		return memo;
	}

	public void setMemo(String memo) {
		this.memo = memo;
	}

	public Integer getNum() {
		return num;
	}

	public void setNum(Integer num) {
		this.num = num;
	}

	@ManyToOne(fetch=FetchType.LAZY)
	public GoodsDomain getGoods() {
		return goods;
	}

	public void setGoods(GoodsDomain goods) {
		this.goods = goods;
	}

	@ManyToOne(fetch=FetchType.LAZY)
	public MemberDomain getMember() {
		return member;
	}

	public void setMember(MemberDomain member) {
		this.member = member;
	}

}
